/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gene.core.util;

import gene.core.Core;
import javax.microedition.lcdui.Graphics;

public class Vector2{

    private short x0_y0_x1_y1[] ={0,0,0,0};
    public Vector2 next;

    /*public boolean collids(int x, int y){
        return false;
    }*/

    public int getDifferenceAxisX(int x,int y){

        /*
        b`   =  ax` - y`
        y`` =  ax`` - b`
        */
        int b = x - x0_y0_x1_y1[1];
        int v = x0_y0_x1_y1[2] - b;

        return  (v-y);

    }

    public int getDifferenceAxisY(int x,int y){

        /*
        b`   =  ax` - y`
        y`` =  ax`` - b`
        */
        int b = x - x0_y0_x1_y1[1];
        int v = x0_y0_x1_y1[2] - b;

        return  (v-y);

    
    }



}

/**
 *
 * @author callagun
 *
public class Vector2 {

private short x0_y0_x1_y1_m_areaX_areaY [] = {0,0,0,0,0,0,0};
/*
private int x0    = 0; // x inicial
private int y0    = 0; // y inicial
private int x1    = 0; // x final
private int y1    = 0; // y final
private int m     = 0; // multiplicador
private int areaX = 0; // area onde se encontra o pondo no ultimo teste de colisao , relativo ao eixo X
private int areaY = 0; // area onde se encontra o pondo no ultimo teste de colisao , relativo ao eixo Y
*
public static final int  AREA_UP     = -1;
public static final int  AREA_EQUALS =  0;
public static final int  AREA_DOWN   =  1;

/**
 * 
 * @param x0
 * @param y0
 * @param x1
 * @param y1
 *
public Vector2(int x0,int y0,int x1,int y1)
{
/*
  this.x0  = x0;
  this.x1  = x1;
  this.y0  = y0;
  this.y1  = y1;
  this.m   = y1/x1;
  *
    this.x0_y0_x1_y1_m_areaX_areaY [0] = (short) x0;
    this.x0_y0_x1_y1_m_areaX_areaY [1] = (short) y0;
    this.x0_y0_x1_y1_m_areaX_areaY [2] = (short) x1;
    this.x0_y0_x1_y1_m_areaX_areaY [3] = (short) y1;

    this.x0_y0_x1_y1_m_areaX_areaY [4] = (short) (y1/x1);
}

/**
 *
 * @param x
 * @param y
 * @return
 *
public boolean collidsAxisY(int x,int y){

    int tmp_y;    
    tmp_y = this.x0_y0_x1_y1_m_areaX_areaY[4] *x;

    //acima
    if(y>tmp_y){

        //this.areaY = AREA_UP;
         this.x0_y0_x1_y1_m_areaX_areaY[6] = AREA_UP;
        return false;

    }
    else{

        if(y<tmp_y){

            //this.areaY = AREA_DOWN;
             this.x0_y0_x1_y1_m_areaX_areaY[6] = AREA_DOWN;
        return false;

        }//abaixo

    }
    //this.areaY= AREA_EQUALS;
        this.x0_y0_x1_y1_m_areaX_areaY[6] = AREA_DOWN;

return true;//colidiu
}

/**
 *
 * @param x
 * @param y
 * @return
 *
public boolean collidsAxisX(int x,int y){

    int tmp_x;    
    tmp_x = x0_y0_x1_y1_m_areaX_areaY[4] * x;

    //acima
    if(y>tmp_x){
        
         //this.areaX = AREA_UP;
        x0_y0_x1_y1_m_areaX_areaY[5] = AREA_UP;
        return false;

    }
    else{

        if(y<tmp_x){

            //this.areaX = AREA_DOWN;
            x0_y0_x1_y1_m_areaX_areaY[5] = AREA_DOWN;
            return false;

        }//abaixo

    }
    //this.areaX= AREA_EQUALS;
    x0_y0_x1_y1_m_areaX_areaY[5] = AREA_EQUALS;
return true;//colidiu
}

/**
 * retorna o ponto y tendo como base o ponto x
 * @param x
 * @return ponto y
 *
public int getPointY(int x){
    //return m*x;
    return x0_y0_x1_y1_m_areaX_areaY[4] * x;
}

/**
 * retorna o ponto x tendo como base o ponto x
 * @param y
 * @return ponto x
 *
public int getPointX(int y){
   //return (y/m);
    return (y/x0_y0_x1_y1_m_areaX_areaY[4]);
}

/**
 * retorna o tamanho do vetor
 * @return
 *
public int getVectorLenght(){
    return 0;
}

/**
 *
 * @return
 *
public int getAxisYArea(){
    //return areaY;
    return this.x0_y0_x1_y1_m_areaX_areaY[6];
}//getAxisYArea

/**
 * 
 * @return
 *
public int getAxisXArea(){
    //return areaX;
    return this.x0_y0_x1_y1_m_areaX_areaY[5];
}//getAxisXArea

Graphics g;

public void paint(){
// Core.getInstance().getCoreGraphics().drawLine(x0, y0, x1, y1);
 Core.getInstance().getCoreGraphics().drawLine(
         this.x0_y0_x1_y1_m_areaX_areaY[0],
         this.x0_y0_x1_y1_m_areaX_areaY[1],
         this.x0_y0_x1_y1_m_areaX_areaY[2],
         this.x0_y0_x1_y1_m_areaX_areaY[3]);
}

}//class
*/